package com.shaobufan.museum.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.io.Serializable;

/**
 * 员工表
 *
 * @TableName staff
 */
@TableName(value = "staff")
@Data
public class Staff implements Serializable {
    /**
     * 员工id
     */
    @TableId(value = "staff_id", type = IdType.AUTO)
    private Integer staffId;

    /**
     * 员工账户
     */
    @TableField(value = "staff_account", updateStrategy = FieldStrategy.NOT_EMPTY)
    private String staffAccount;

    /**
     * 员工密码
     */
    @TableField(value = "staff_password", updateStrategy = FieldStrategy.NOT_EMPTY)
    private String staffPassword;

    /**
     * 员工权限 馆长 - 0 其他 - 1
     */
    @TableField(value = "staff_privilege", updateStrategy = FieldStrategy.NOT_EMPTY)
    private Integer staffPrivilege;

    /**
     * 逻辑删除
     */
    @TableField(value = "is_delete")
    @TableLogic
    private Integer isDelete;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Staff other = (Staff) that;
        return (this.getStaffId() == null ? other.getStaffId() == null : this.getStaffId().equals(other.getStaffId()))
                && (this.getStaffAccount() == null ? other.getStaffAccount() == null : this.getStaffAccount().equals(other.getStaffAccount()))
                && (this.getStaffPassword() == null ? other.getStaffPassword() == null : this.getStaffPassword().equals(other.getStaffPassword()))
                && (this.getStaffPrivilege() == null ? other.getStaffPrivilege() == null : this.getStaffPrivilege().equals(other.getStaffPrivilege()))
                && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getStaffId() == null) ? 0 : getStaffId().hashCode());
        result = prime * result + ((getStaffAccount() == null) ? 0 : getStaffAccount().hashCode());
        result = prime * result + ((getStaffPassword() == null) ? 0 : getStaffPassword().hashCode());
        result = prime * result + ((getStaffPrivilege() == null) ? 0 : getStaffPrivilege().hashCode());
        result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", staffId=").append(staffId);
        sb.append(", staffAccount=").append(staffAccount);
        sb.append(", staffPassword=").append(staffPassword);
        sb.append(", staffPrivilege=").append(staffPrivilege);
        sb.append(", isDelete=").append(isDelete);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}